#include<iostream>
#include<vector>
//双指针
using namespace std;
class Solution {
public:
    int maxArea(vector<int>& height) {
        int n = height.size();
        int left = 0;
        int right = n-1;
        int ret = 0;
        while(left<right)
        {
            ret = max(ret,(right-left)*min(height[right],height[left]));
            if(height[left]<height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return ret;
    }
};